package com.lsx.logisticscore.entity;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: Liang
 * @Date: 2022/02/08
 * @Description:
 */
@Data
public class News {
    public Integer id;
    public String title;
    public String content;
    public String cover;
    public Account creator;
    public Date createTime;
    public Date updateTime;

    public String getCreateTime() {
        if (this.createTime != null){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String date = sdf.format(this.createTime);
            return date;
        }
        return null;
    }

    public String getUpdateTime() {
        if (this.updateTime != null){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String date = sdf.format(this.updateTime);
            return date;
        }
        return null;
    }
}
